load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
    name = "bulkpb_proto",
    srcs = ["bulkpb.proto"],
    strip_import_prefix = "/pkg",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/util/hlc:hlc_proto",
        "@com_github_gogo_protobuf//gogoproto:gogo_proto",
    ],
)

go_proto_library(
    name = "bulkpb_go_proto",
    compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/bulk/bulkpb",
    proto = ":bulkpb_proto",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/util/hlc",
        "@com_github_gogo_protobuf//gogoproto",
    ],
)

go_library(
    name = "bulkpb",
    srcs = [
        "bulk.go",
        "ingestion_performance_stats.go",
    ],
    embed = [":bulkpb_go_proto"],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/bulk/bulkpb",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/roachpb",
        "//pkg/util/bulk",
        "//pkg/util/hlc",
        "//pkg/util/humanizeutil",
        "//pkg/util/log",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_codahale_hdrhistogram//:hdrhistogram",
        "@com_github_gogo_protobuf//proto",
        "@io_opentelemetry_go_otel//attribute",
    ],
)

go_test(
    name = "bulkpb_test",
    srcs = ["ingestion_performance_stats_test.go"],
    embed = [":bulkpb"],
    deps = [
        "//pkg/roachpb",
        "//pkg/util/bulk",
        "//pkg/util/tracing",
        "//pkg/util/tracing/tracingpb",
        "@com_github_codahale_hdrhistogram//:hdrhistogram",
        "@com_github_gogo_protobuf//proto",
        "@com_github_stretchr_testify//require",
    ],
)
